#coding=utf-8
__author__ = 'liubin'

from project.tools import Base
from sqlalchemy import Column, Integer, String, BigInteger, ForeignKey, Boolean, Text
from sqlalchemy.orm import relationship, backref
from sqlalchemy.sql.expression import text
from project.tools import JsonpickleMixin
from base import BaseModel


class Color(BaseModel, Base):
    """
    颜色表
    """
    __tablename__ = 'm_color'
    # 种类名
    name = Column('name', String(200), nullable=False, doc=u'名称')
    # 备注
    comment = Column('comment', Text, nullable=False, doc=u'备注')
    # 是否被删除
    isDeleted = Column('is_deleted', Boolean, server_default=text('FALSE'), doc=u'是否已删除')

    def __init__(self, data=None):
        """
        初始化
        :param data:
        :return:
        """
        if data:
            self.name = data.get('name')
            self.comment = data.get('comment')